import { IPublicTypeComponentMetadata, IPublicTypeSnippet } from '@alilc/lowcode-types';

const WeatherForecastPanelMeta: IPublicTypeComponentMetadata = {
  componentName: 'WeatherForecastPanel',
  title: '气象防灾右侧',
  category: '信息展示',
  group: '气象防灾',
  docUrl: '',
  screenshot: '',
  devMode: 'proCode',
  npm: {
    package: 'hzdz-charts',
    version: '0.1.0',
    exportName: 'WeatherForecastPanel',
    main: 'src/index.tsx',
    destructuring: true,
    subName: ''
  },
  props: [
    {
      name: 'ref',
      propType: 'object',
    },
    {
      name: 'key',
      propType: 'string',
    },
    {
      name: 'style',
      propType: 'object',
    },
    {
      name: 'className',
      propType: 'string',
    },
    {
      name: 'width',
      propType: 'number',
      description: '组件宽度'
    },
    {
      name: 'height',
      propType: 'number',
      description: '组件高度'
    },
    {
      name: 'tabs',
      propType: 'array',
      description: '预报类型选项卡'
    },
    {
      name: 'periods',
      propType: 'array',
      description: '天气预报时段'
    },
    {
      name: 'activeTabTextColor',
      propType: 'string',
      description: '激活选项卡文字颜色'
    },
    {
      name: 'inactiveTabTextColor',
      propType: 'string',
      description: '非激活选项卡文字颜色'
    },
    {
      name: 'timeTextColor',
      propType: 'string',
      description: '时间文字颜色'
    },
    {
      name: 'weatherTextColor',
      propType: 'string',
      description: '天气描述文字颜色'
    },
    {
      name: 'tabFontSize',
      propType: 'number',
      description: '选项卡字体大小'
    },
    {
      name: 'timeFontSize',
      propType: 'number',
      description: '时间字体大小'
    },
    {
      name: 'weatherFontSize',
      propType: 'number',
      description: '天气描述字体大小'
    },
    {
      name: 'defaultActiveTab',
      propType: 'string',
      description: '默认激活选项卡'
    },
    {
      name: 'theme',
      propType: 'string',
      description: '主题'
    },
    {
      name: 'onTabClick',
      propType: 'func',
      description: '选项卡点击事件'
    },
    {
      name: 'onPeriodClick',
      propType: 'func',
      description: '时段点击事件'
    },
    {
      name: 'onClick',
      propType: 'func',
      description: '点击事件'
    }
  ],
  configure: {
    props: [
      {
        name: 'activeTabTextColor',
        title: { label: { type: 'i18n', 'en-US': 'activeTabTextColor', 'zh-CN': '激活选项卡文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
      },
      {
        name: 'inactiveTabTextColor',
        title: { label: { type: 'i18n', 'en-US': 'inactiveTabTextColor', 'zh-CN': '非激活选项卡文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.9)' }
      },
      {
        name: 'timeTextColor',
        title: { label: { type: 'i18n', 'en-US': 'timeTextColor', 'zh-CN': '时间文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: '#FFFFFF' }
      },
      {
        name: 'weatherTextColor',
        title: { label: { type: 'i18n', 'en-US': 'weatherTextColor', 'zh-CN': '天气描述文字颜色' } },
        setter: { componentName: 'ColorSetter', isRequired: false, initialValue: 'rgba(255,255,255,0.8)' }
      },
      {
        name: 'tabFontSize',
        title: { label: { type: 'i18n', 'en-US': 'tabFontSize', 'zh-CN': '选项卡字体大小' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 14 }
      },
      {
        name: 'timeFontSize',
        title: { label: { type: 'i18n', 'en-US': 'timeFontSize', 'zh-CN': '时间字体大小' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
      },
      {
        name: 'weatherFontSize',
        title: { label: { type: 'i18n', 'en-US': 'weatherFontSize', 'zh-CN': '天气描述字体大小' } },
        setter: { componentName: 'NumberSetter', isRequired: false, initialValue: 16 }
      },
      {
        name: 'defaultActiveTab',
        title: { label: { type: 'i18n', 'en-US': 'defaultActiveTab', 'zh-CN': '默认激活选项卡' } },
        setter: { componentName: 'SelectSetter', isRequired: false, initialValue: '2hour' }
      }
    ],
    supports: {
      style: true
    }
  }
};

const snippets: IPublicTypeSnippet[] = [
  {
    title: '气象防灾右侧',
    screenshot: '',
    schema: {
      componentName: 'WeatherForecastPanel',
      props: {
        width: 500,
        height: 1080,
        tabs: [
          {
            id: '2hour',
            text: '2小时气象预报',
            isActive: true,
            backgroundImage: 'http://localhost:8085/static/images/qixiangfangzhai/bz149bf.png'
          },
          {
            id: '7day',
            text: '7天气象预报',
            isActive: false,
            backgroundColor: 'rgba(5,18,34,0.2)',
            borderColor: '#3A4E74',
            borderRadius: '0px 4px 4px 0px'
          }
        ],
        periods: [
          {
            id: '1',
            time: '17时',
            weather: '小雨',
            iconType: 'image',
            icon: 'http://localhost:8085/static/images/qixiangfangzhai/weather-rain-light.png'
          },
          {
            id: '2',
            time: '21时',
            weather: '大雨',
            iconType: 'image',
            icon: 'http://localhost:8085/static/images/qixiangfangzhai/weather-rain-heavy.png'
          },
          {
            id: '3',
            time: '1时',
            weather: '晴',
            iconType: 'gradient',
            iconGradient: ['#FFFFFF', '#FFEC91']
          },
          {
            id: '4',
            time: '5时',
            weather: '晴',
            iconType: 'gradient',
            iconGradient: ['#FFFFFF', '#FFEC91']
          },
          {
            id: '5',
            time: '9时',
            weather: '多云',
            iconType: 'image',
            icon: 'http://localhost:8085/static/images/qixiangfangzhai/weather-cloudy.png'
          },
          {
            id: '6',
            time: '9时',
            weather: '多云',
            iconType: 'image',
            icon: 'http://localhost:8085/static/images/qixiangfangzhai/weather-cloudy.png'
          },
          {
            id: '7',
            time: '9时',
            weather: '多云',
            iconType: 'image',
            icon: 'http://localhost:8085/static/images/qixiangfangzhai/weather-cloudy.png'
          }
        ],
        activeTabTextColor: '#FFFFFF',
        inactiveTabTextColor: 'rgba(255,255,255,0.9)',
        timeTextColor: '#FFFFFF',
        weatherTextColor: 'rgba(255,255,255,0.8)',
        tabFontSize: 14,
        timeFontSize: 16,
        weatherFontSize: 16,
        tabFontWeight: 400,
        timeFontWeight: 500,
        weatherFontWeight: 400,
        defaultActiveTab: '2hour',
        theme: 'dark'
      }
    }
  }
];

export default {
  ...WeatherForecastPanelMeta,
  snippets
};
